const tran = Symbol('Context#tran')

module.exports = {
  // 报文封装
  renderBack(data = {}, busiCode = '1', busiMsg = '成功', code = 200, msg = '成功') {
    this.status = +code
    this.body = {
      code,
      msg,
      data: {
        busiCode,
        msg: busiMsg,
        ...data
      }
    }
  },
  async tran() {
    if (!this[tran]) {
      this[tran] = await this.app.model.transaction()
    }
    return this[tran]
  },
  getTran() {
    return this[tran]
  }
}
